package edu.suda.basic.sigar;

import org.hyperic.sigar.*;

import com.thoughtworks.xstream.XStream;

public class CPU
{

	private CpuInfo	info;

	private CpuPerc	perc;

	private Cpu		timer;

	public CPU()
	{

	}

	public void populate(Sigar sigar) throws SigarException
	{

		info = sigar.getCpuInfoList()[0];

		perc = sigar.getCpuPerc();

		timer = sigar.getCpu();

	}

	public static CPU gather(Sigar sigar) throws SigarException
	{

		CPU data = new CPU();

		data.populate(sigar);

		return data;

	}

	public static void main(String[] args) throws Exception
	{

		System.out.println(System.getProperty("java.library.path"));

		Sigar sigar = new Sigar();

		CPU cpuData = CPU.gather(sigar);

		XStream xstream = new XStream();

		xstream.alias("CpuData", CPU.class);

		System.out.println(xstream.toXML(cpuData));

	}

}
